/**
 * 
 */
package com.m7012e.a_remote.commons;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

import com.m7012e.a_remote.communication.TcpMessage;

/**
 * @author leoj
 *
 */
public class ARemoteTcpSender {
	public static void sendMessage(TcpMessage m, String address, int port) throws UnknownHostException, IOException{
		System.out.println("static ARemoteTcpSender.sendMessage-> @"+address+":"+port);
		Socket sock = new Socket(address, port);
		ObjectOutputStream ouput = new ObjectOutputStream(sock.getOutputStream());
		ouput.writeObject(m);
		ouput.flush();
		sock.close();
		System.out.println("static ARemoteTcpSender.sendMessage over !");
	}
}
